const queryAllOrder = require('./queryAllOrder/index');
const queryCloseOrder = require('./queryCloseOrder/index');
const queryOrderByOutTradeNo = require('./queryOrderByOutTradeNo/index');
const queryPaidOrder = require('./queryPaidOrder/index');
const queryPendingOeder = require('./queryPendingOeder/index');
const queryRefundOrder = require('./queryRefundOrder/index');
const updateOrderStatus = require('./updateOrderStatus/index');
const queryNotPayOrderAll = require('./queryNotPayOrderAll/index');

// 云函数入口函数
exports.main = async (event, context) => {
  switch (event.type) {
    case 'queryAllOrder':
      return await queryAllOrder.main(event, context);
    case 'queryCloseOrder':
      return await queryCloseOrder.main(event, context);
    case 'queryOrderByOutTradeNo':
      return await queryOrderByOutTradeNo.main(event, context);
    case 'queryPaidOrder':
      return await queryPaidOrder.main(event, context);
    case 'queryPendingOeder':
      return await queryPendingOeder.main(event, context);
    case 'queryRefundOrder':
      return await queryRefundOrder.main(event, context);
    case 'updateOrderStatus':
      return await updateOrderStatus.main(event, context);
    case 'queryNotPayOrderAll':
      return await queryNotPayOrderAll.main(event, context);
    default:
      return {
        errCode: -1,
        errMsg: 'TYPE_NOT_EXIST'
      }
  }
}